#ifndef LAPI_SETTING_H
#define LAPI_SETTING_H

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdarg.h>
#include <errno.h>
#include <sys/stat.h>

#ifdef LAPI_X86
#define LAPI_SETTING_FILE "/download/lapi.rc"
#else
#define LAPI_SETTING_FILE "/data/location/lapi.rc"
#endif

#define LAPI_DEFAULT_SETTING_FILE "/system/location/lapi.rc"
#define LAPI_SETTING_FILE_DIR "/data/location/"
#define LAPI_SETTING_LINE_LEN 80

#define ATTR_LOC_METHOD "LOC_METHOD"
#define ATTR_RST_TYPE "RST_TYPE"
#define ATTR_SRV_ADDR "SRV_ADDR"
#define ATTR_SRV_PORT "SRV_PORT"
#define ATTR_QOS_HOR "QOS_HOR"
#define ATTR_QOS_VER "QOS_VER"
#define ATTR_QOS_TIMEOUT "QOS_TIMEOUT"
#define ATTR_FIX_INTERVAL "FIX_INTERVAL"
#define ATTR_IMSI "IMSI"
#define ATTR_LAC "LAC"
#define ATTR_CID "CID"
#define ATTR_GPRS_DEV "GPRS_DEV"
#define ATTR_CA_PATH "CA_PATH"
#define ATTR_ASSIST_PROTOCOL "ASSIST_PROTOCOL"
#define ATTR_NW_OP "NW_OP"
#define ATTR_NW_TYPE "NW_TYPE"

#if 0
Move to lapi.h
/**
* Location Method Types
*/
typedef enum
{
    /** Indicates that the SUPL Autonomous Location Method is to be used */
    LAPI_LOCATION_METHOD_AUTONOMOUS = 0,
        
    /** Indicates that the MS-Based (Network Assisted) Location Method is to be used 
    and Measure Position Request OTA */
    LAPI_LOCATION_METHOD_MS_BASED,
        
    /** Indicates that the MS-Assisted (Network Centric) Location Method is to be used */
    LAPI_LOCATION_METHOD_MS_ASSISTED,

    /** Indicates that a combination of methods is to be used. The final Location method 
    *   will be determined by the handshaking between SET and SLC
    */
    LAPI_LOCATION_METHOD_COMBO,

    /** Indicates that the Standalone Location Method is to be used */
    LAPI_LOCATION_METHOD_STANDALONE,
    
    /** Indicates that the Enhanced Cell ID Location Method is to be used */
    LAPI_LOCATION_METHOD_ECID
} LAPI_LOCATION_METHOD;

/**
* Reset Types
*/
typedef enum
{
	/** Indicates that Factory Reset command should be sent to the GPS Client at the start of a session */
    LAPI_RESET_TYPE_FACTORY_RESET = 0,
        
    /** Indicates a Cold Start Reset command should be sent to the GPS Client at the start of a session */
    LAPI_RESET_TYPE_COLD_RESET,
        
    /** Indicates a Hot Start Reset command should be sent to the GPS Client at the start of a session */
    LAPI_RESET_TYPE_HOT_RESET,

    /** Indicates a Warm Start Reset command should be sent to the GPS Client at the start of a session */
    RESET_TYPE_WARM_RESET
} LAPI_RESET_TYPE;

typedef struct _LAPI_SETTING_S {
    LAPI_LOCATION_METHOD method;
    LAPI_RESET_TYPE reset;
    char srv_addr[AGPS_SRV_ADDR_LEN];
    LAPI_UINT32 srv_port;
    struct {
        LAPI_UINT32 hor_accuracy;
        LAPI_UINT32 ver_accuracy;
        LAPI_UINT32 timeout;
    } qos;
    LAPI_UINT32 interval;
    char imsi[AGPS_IMSI_LEN];
    char lac[AGPS_LAC_LEN];
    char cid[AGPS_CID_LEN];
    char gprs_dev[AGPS_GPRSIF_LEN];
    int gprs_pro;
} LAPI_SETTING_S;
#endif

/* global setting */
extern LAPI_SETTING_S g_lapi_setting;

void lapi_print_setting();

int lapi_load_setting();

#endif
